Forum Discussion
Testranger
14 years agoContributor
Hi McDonald,
Thanks for the tip...I'll give it a go.
I have a new challenge now, perhaps you can help.
Given:
def toadd = '''
<ns22:references xmlns="http://test.com/rpdesktop/faults/" xmlns:ns2="http://test.com/ws/2010/08/Common" xmlns:ns3="http://test.com/dataservices/ws/2011/09/Order" xmlns:ns4="http://test.com.au/rpservices/ws/2010/08/StructuredAddress" xmlns:ns5="http://test.com.au/rpservices/ws/2010/08/DigitalResource" xmlns:ns6="http://test.com.au/rpservices/ws/2010/08/ExternalReference" xmlns:ns7="http://test.com.au/rpservices/ws/2010/08/CommonEntity" xmlns:ns8="http://test.com.au/rpservices/ws/2010/08/IndividualEntity" xmlns:ns9="http://test.com.au/rpservices/ws/2010/08/User" xmlns:ns10="http://test.com.au/rpservices/ws/2010/08/SystemEntity" xmlns:ns11="http://test.com.au/rpservices/ws/2010/08/OrganisationEntity" xmlns:ns12="http://test.com.au/rpservices/ws/2010/08/Lender" xmlns:ns13="http://test.com.au/rpservices/ws/2010/08/MortgageManager" xmlns:ns14="http://test.com.au/rpservices/ws/2010/08/ValuationFirm" xmlns:ns15="http://test.com/dataservices/ws/2011/01/Security" xmlns:ns16="http://test.com.au/rpservices/ws/2010/08/Valuer" xmlns:ns17="http://test.com.au/rpservices/ws/2010/08/MortgageBroker" xmlns:ns18="http://test.com/dataservices/ws/2011/09/Valuation" xmlns:ns19="http://test.com.au/rpservices/ws/2010/08/Property" xmlns:ns20="http://test.com.au/rpservices/ws/2010/08/Parcel" xmlns:ns21="http://test.com.au/rpservices/ws/2010/08/Transfer" xmlns:ns22="http://test.com/rpdesktop/messages/" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>BATHZZZ</ns19:feature>
<ns19:value>1</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>BED</ns19:feature>
<ns19:value>3</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>CARSPACES</ns19:feature>
<ns19:value>2</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>AREA</ns19:feature>
<ns19:value>669</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>AREAUROOF</ns19:feature>
<ns19:value>0</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>ZONING</ns19:feature>
<ns19:value/>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyResource" ns19:xmlId="X6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:digitalResource>
<ns5:externalReference>
<ns6:type>BSG</ns6:type>
<ns6:code>d6fece6e-4997-4ae5-8047-f8c27ae3e02e</ns6:code>
</ns5:externalReference>
<ns5:url>http://test.com/rpdaAU/photo/listsale/768x512/11/09/08/19553050/19553050_1.JPG</ns5:url>
</ns19:digitalResource>
</ns22:reference>
<ns22:reference xsi:type="ns4:PostCode" ns4:xmlId="X7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns4:country>AU</ns4:country>
<ns4:postCode>2141</ns4:postCode>
</ns22:reference>
<ns22:reference xsi:type="ns4:ThoroughfareNumber" ns4:xmlId="X8" ns4:postCode="X7" ns4:thoroughfare="X9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns4:number>9</ns4:number>
</ns22:reference>
<ns22:reference xsi:type="ns4:Thoroughfare" ns4:xmlId="X9" ns4:locality="X10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns4:type>RD</ns4:type>
<ns4:name>Hyde Park</ns4:name>
</ns22:reference>
<ns22:reference xsi:type="ns4:Locality" ns4:xmlId="X10" ns4:postCode="X7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns4:administrativeArea>NSW</ns4:administrativeArea>
<ns4:country>AU</ns4:country>
<ns4:type>1</ns4:type>
<ns4:name>Berala</ns4:name>
</ns22:reference>
</ns22:references>
'''
Is it possible to append this to a request similiar to how the following code works:
def node = requestHolder.getDomNode("//ns22:updateRequest[1]")
// use DOMCategory to simplify things..
use( DOMCategory )
{
def ns = "http://xyz.ca/ebusiness/ProductService"
// BUILD NODE TO APPEND...add new "ProdSet" element..
def prodSet = node.appendNode( new QName( ns, "ProdSet", "prod1"))
}
requestHolder.updateProperty(true)
But where "def prodSet = node.appendNode" is called I think it would be easier to have some function to parse the "toadd" variable to QName so appendNode can be called.
For instance,
def prodSet = node.appendNode(...parseTextToQName(toadd))
Building a QName representation of the xml string represented by "toadd" would be hell. Confusion around how to do this has caused most of my issues.
Really appreciate your help and recommendations.
Regards,
Testranger
Thanks for the tip...I'll give it a go.
I have a new challenge now, perhaps you can help.
Given:
def toadd = '''
<ns22:references xmlns="http://test.com/rpdesktop/faults/" xmlns:ns2="http://test.com/ws/2010/08/Common" xmlns:ns3="http://test.com/dataservices/ws/2011/09/Order" xmlns:ns4="http://test.com.au/rpservices/ws/2010/08/StructuredAddress" xmlns:ns5="http://test.com.au/rpservices/ws/2010/08/DigitalResource" xmlns:ns6="http://test.com.au/rpservices/ws/2010/08/ExternalReference" xmlns:ns7="http://test.com.au/rpservices/ws/2010/08/CommonEntity" xmlns:ns8="http://test.com.au/rpservices/ws/2010/08/IndividualEntity" xmlns:ns9="http://test.com.au/rpservices/ws/2010/08/User" xmlns:ns10="http://test.com.au/rpservices/ws/2010/08/SystemEntity" xmlns:ns11="http://test.com.au/rpservices/ws/2010/08/OrganisationEntity" xmlns:ns12="http://test.com.au/rpservices/ws/2010/08/Lender" xmlns:ns13="http://test.com.au/rpservices/ws/2010/08/MortgageManager" xmlns:ns14="http://test.com.au/rpservices/ws/2010/08/ValuationFirm" xmlns:ns15="http://test.com/dataservices/ws/2011/01/Security" xmlns:ns16="http://test.com.au/rpservices/ws/2010/08/Valuer" xmlns:ns17="http://test.com.au/rpservices/ws/2010/08/MortgageBroker" xmlns:ns18="http://test.com/dataservices/ws/2011/09/Valuation" xmlns:ns19="http://test.com.au/rpservices/ws/2010/08/Property" xmlns:ns20="http://test.com.au/rpservices/ws/2010/08/Parcel" xmlns:ns21="http://test.com.au/rpservices/ws/2010/08/Transfer" xmlns:ns22="http://test.com/rpdesktop/messages/" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>BATHZZZ</ns19:feature>
<ns19:value>1</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>BED</ns19:feature>
<ns19:value>3</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>CARSPACES</ns19:feature>
<ns19:value>2</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>AREA</ns19:feature>
<ns19:value>669</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>AREAUROOF</ns19:feature>
<ns19:value>0</ns19:value>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyFeature" ns19:xmlId="X5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:feature>ZONING</ns19:feature>
<ns19:value/>
</ns22:reference>
<ns22:reference xsi:type="ns19:PropertyResource" ns19:xmlId="X6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns19:digitalResource>
<ns5:externalReference>
<ns6:type>BSG</ns6:type>
<ns6:code>d6fece6e-4997-4ae5-8047-f8c27ae3e02e</ns6:code>
</ns5:externalReference>
<ns5:url>http://test.com/rpdaAU/photo/listsale/768x512/11/09/08/19553050/19553050_1.JPG</ns5:url>
</ns19:digitalResource>
</ns22:reference>
<ns22:reference xsi:type="ns4:PostCode" ns4:xmlId="X7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns4:country>AU</ns4:country>
<ns4:postCode>2141</ns4:postCode>
</ns22:reference>
<ns22:reference xsi:type="ns4:ThoroughfareNumber" ns4:xmlId="X8" ns4:postCode="X7" ns4:thoroughfare="X9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns4:number>9</ns4:number>
</ns22:reference>
<ns22:reference xsi:type="ns4:Thoroughfare" ns4:xmlId="X9" ns4:locality="X10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns4:type>RD</ns4:type>
<ns4:name>Hyde Park</ns4:name>
</ns22:reference>
<ns22:reference xsi:type="ns4:Locality" ns4:xmlId="X10" ns4:postCode="X7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns4:administrativeArea>NSW</ns4:administrativeArea>
<ns4:country>AU</ns4:country>
<ns4:type>1</ns4:type>
<ns4:name>Berala</ns4:name>
</ns22:reference>
</ns22:references>
'''
Is it possible to append this to a request similiar to how the following code works:
def node = requestHolder.getDomNode("//ns22:updateRequest[1]")
// use DOMCategory to simplify things..
use( DOMCategory )
{
def ns = "http://xyz.ca/ebusiness/ProductService"
// BUILD NODE TO APPEND...add new "ProdSet" element..
def prodSet = node.appendNode( new QName( ns, "ProdSet", "prod1"))
}
requestHolder.updateProperty(true)
But where "def prodSet = node.appendNode" is called I think it would be easier to have some function to parse the "toadd" variable to QName so appendNode can be called.
For instance,
def prodSet = node.appendNode(...parseTextToQName(toadd))
Building a QName representation of the xml string represented by "toadd" would be hell. Confusion around how to do this has caused most of my issues.
Really appreciate your help and recommendations.
Regards,
Testranger