Ant : Ant project
Ant-contrib : Ant-Contrib Project
xmltask : sourceforge xmltask
[카테고리:] 작업일지/SMGR
XPath 의 표현
XPath의 표현식
예)
//map[ @varSetName=’images’]/key[@name=’name’]/value/@valueString
위와 같은 표현일때 해당되는 노드가 여러개이면 리스트 형태로 나온다.
((LIST[ ‘조건식1 또는 index”])[‘조건식2 또는 index”])[‘조건식3 또는 index’]
위와 같이 리스트형태의 Index또는 조건식을 수행함으로서 특정 노드를 찾아낼 수 있다.
Python – 간단한 minidom 사용법
xml.dom.minidom:
1 from xml.dom.minidom import parse, parseString
2
3 dom1 = parse( “foaf.rdf” ) # parse an XML file
4 dom2 = parseString( “<myxml>Some data <empty/> some more data</myxml>” )
5 print dom1.toxml()
6 print dom2.toxml()
Examples of Use
- node.nodeName
- node.nodeValue
- node.childNodes
Find Elements
You can manually walk through the childNodes tree, comparing nodeNames.
You might be able to use getElementsByTagName as well:
1 from xml.dom.minidom import parse
2 dom = parse(“foo.xml”)
3 for node in dom.getElementsByTagName(‘bar’): # visit every node <bar />
4 print node.toxml()
getElementsByTagName, works recursively into the tree, I believe.
Add an Element
Create & add an XML element (Something like <foo />) to an XML document.
1 from xml.dom.minidom import parse
2 dom = parse(“bar.xml”)
3 x = dom.createElement(“foo”) # creates <foo />
4 dom.childNodes[1].appendChild(x) # appends at end of 1st child’s children
5 print dom.toxml()
Add an Element with Text Inside
Create & add an XML element to an XML document, the element has text inside.
ex: <foo>hello, world!</foo>
1 from xml.dom.minidom import parse
2 dom = parse(“bar.xml”)
3 x = dom.createElement(“foo”) # creates <foo />
4 txt = dom.createTextNode(“hello, world!”) # creates “hello, world!”
5 x.appendChild(txt) # results in <foo>hello, world!</foo>
6 dom.childNodes[1].appendChild(x) # appends at end of 1st child’s children
7 print dom.toxml()
Import a Node
You can use DOM 2 “importNode” to take part of one XML document, and put it into another XML document.
1 from xml.dom.minidom import parse
2 dom1 = parse(“foo.xml”)
3 dom2 = parse(“bar.xml”)
4 x = dom1.importNode(dom2.childNodes[1], # take 2nd node in “bar.xml”
5 True) # deep copy
6 dom1.childNodes[1].appendChild(x) # append to children of 2nd node in “foo.xml”
7 print dom1.toxml()
Links
Python Library Reference, xml.dom.minidom — API documentation
Dive into Python, Chapter 5 — works almost entirely out of the minidom API
See Also
출처 http://wiki.python.org/moin/MiniDom
xml문서 만들기
from xml.dom import minidomActually the how-to could be finished here, but I will show a little bit more about the minidom.# New document
xml = minidom.Document()
The next snippet shows how to create an element, set attributes and add this on our document created in the last step.
# Creates user element
userElem = xml.createElement(“user”)# Set attributes to user element
userElem.setAttribute(“name”, “Sergio Oliveira”)
userElem.setAttribute(“nickname”, “seocam”)
userElem.setAttribute(“email”, “seocam@seocam.net”)
userElem.setAttribute(“photo”,”seocam.png”)# Append user element in xml document
xml.appendChild(userElem)
If you know the DOM specification nothing until here is new for you, but the next 2 snippets shows how to return a string and how to write a file with our xml document.
# Print the xml code
print xml.toxml(“UTF-8″)
fp = open(“file.xml”,”w”)
xml.writexml(fp, ” “, “”, “\n”, “UTF-8″)# Method’s stub
# writexml(self, writer, indent=”, addindent=”, newl=”, encoding=None)
The result generated by both methods:
<?xml version=”1.0″ encoding=”UTF-8″?>
<user email=”seocam@seocam.net” name=”Sergio Oliveira”
nickname=”seocam” photo=”seocam.png”>출
출처 http://www.seocam.net/how-tos/creating-a-new-xml-document-with-python-minidom
ora-12638 credential retrieval failed
ora-12638 credential retrieval failed 에 대한 Oracle 포럼 에 올라와 있는 답변
Hi JA,
I’m no Oracle expert, but from what can make out the NTS option makes the Oracle client attempt to use your current Windows domain credentials to authenticate you with the Oracle server. This could fail for a couple of reasons:
– The Oracle server is not configured to support Windows authentication
– The credentials you use to login to your local machine are not sufficient to allow you to login to the server.
In my case, it was the later. Despite the fact that I had told the client to use a different user name and password, it was still attempting to login using my domain credentials first. This failed because I was logged on to my local machine using my normal domain credentials rather than my administrator account.
Replacing the line:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
with
SQLNET.AUTHENTICATION_SERVICES= (NONE)
in sqlnet.ora resolved the issue by disabling local support for authenticating using Windows credentials.
HTH,
Carey
출처 – oracle forum
http://forums.oracle.com/forums/thread.jspa?threadID=332525