DOM and Namespaces
Hi,
I have two XML schema documents. (A.xsd and B.xsd)
Now i am parsing B.xsd using DOM. B.xsd has a definition like this :
<xs:element ref="a:Employee"/>
where 'a' is a namespace prefix. its actual definition is in A.xsd defined like this :
<xs:element name="Employee" type="EmployeeType"/>
While parsing B.xsd, I have found an element having reference to different namespace and the definitions are actully in different schema file.
DOM content tree will have only the content of B.xsd. Are there any APIs to extract details of the elements defined in some other document / Namespaces??
I am interested to fetch the 'type' attribute of the element. i.e., "EmployeeType"
Can anyone please help me out in this regard. ?
Regards,
Guru Hanchinal
Next release is planed to be out next week. We will annouced here when they are ready for download.
Similar Messages
-
Difference between DOM and SAX
Difference between DOM and SAX
a sax parser is event driven meaning it processes the xml as it sees it and then forgets about it.
you have to implement what you want the parser to do wants it reaches a certain event
dom on the other hand keeps the whole structure of the message in memory as a tree.
so there are strengths and weaknesses in both.
you have to evaluate what you need -
Delete elements from XML file using DOM and java
Hi
I want now is to remove element from my XML file
for example
i have following xml
<?xml version="1.0" encoding="UTF-8"?>
<printing>
<firstLineTexts>
<firstLineText />
<firstLineText>|line11</firstLineText>
<firstLineText>|line12</firstLineText>
</firstLineTexts>
</printing>how do i remove all elements fireLineText
my final output should be
<?xml version="1.0" encoding="UTF-8"?>
<printing>
<firstLineTexts>
</firstLineTexts>
</printing>How do i do it using DOM,
I can create instance of DOM and write it using TransformerFactory
AshishHi
I am trying the following code,
but it is not working
NodeList nScene = doc.getElementsByTagName("firstLineTexts");
NodeList nScene1 = nScene.item(0).getChildNodes();
for (int i = 0; i < nScene1.getLength(); i++)
Node n = nScene1.item(i);
nScene.item(0).removeChild(n);
} -
Soap sender adpater issue missing sender interface and namespace in the msg
Hi Expert,
I got a problem when try to using soap sender adapter.
Here is the sceanrio:
Http web service client call ---PI soap sender adapter -some routing data-business system inbound.
Sytem information:
SAP_ABA 700 0019 SAPKA70019 Cross-Application Component
SAP_BASIS 700 0019 SAPKB70019 SAP Basis Component
PI_BASIS 2005_1_700 0019 SAPKIPYJ7J PI_BASIS 2005_1_700
ST-PI 2008_1_700 0001 SAPKITLRD1 SAP Solution Tools Plug-In
SAP_BW 700 0021 SAPKW70021 SAP NetWeaver BI 7.0
ST-A/PI 01L_BCO700 0000 - Servicetools for other App./Netweaver 04
Here is my problem. I use soapui trigger a test msg to PI system. But in the sxmb_moni, only sender service is there.
The sender interface and sender namespace is missing. And the msg has error called: :INTERFACE_REGISTRATION_ERROR.
Which means I do not have a inbound interface to process the msg.
But I suppose to redirect the msg to business system.
Here is the configuration:
reciever determination: soap sender service, soap outbound interface, soap interface namespace --> reciever business sytem.
Interface ditermination: soap sender service, soap interface --> receiver interface, receiver namespace.
Sender agreement: soap service, soap itnerface --- soap communication channel
receiver agreement, soap service---> receiver sevice, receiver interface, reciever namespace and reciever cummunication channel
define of soap sender adapter:
soap sernder, with use encoded header and use query string checked and qos as exactly once.
Anyone has any idea here? Many thanks! And most strange thing is yesterday it works and today it failed.
Please kindly help here.
Thanks a lot,
LeonHi guys,
thanks for the input.
Hi Sven,
I have input default interface and namespace.
Hi sivasakthi,
Regarding mistype, it may happen, I will do it again right away.
And the URL is generated by the wsdl toolkit in the directory.
I marked use encoded header and query string in the communication channel.
I will generate the wsdl again and test it again.
Regarding URL(endpoint of web service):
http://hostname:50000/XISOAPAdapter/MessageServlet?channel=:AGSSAL_SOAP:AGSSAL_SOAP_CC&version=3.0&Sender.Service=AGSSAL_SOAP&Interface=urn:a1s_saplivelinkcontent.service.sap.com^MI_O_AS_DELIVERNOTIFY_SOAP
Again thanks for you guys help.
Best regards,
Leon -
Deleting Message Type name and namespace tag from XML payload
Hi Gurus,
Need help. My payload looks like this
<?xml version="1.0" encoding="utf-8" ?>
- <ns1:MT_O_sss xmlns:ns1="http://sap.com/xi/tm">
- <Job>
<Field name="xxxx" value="" />
<Field name="xxx" value="" />
<Field name="xxx" value="" />
</Job>
</ns1:MT_O_sss>
But The soap webservice is expecting it in
<?xml version="1.0" encoding="utf-8" ?>
- <Job>
<Field name="xxxx" value="" />
<Field name="xxx" value="" />
<Field name="xxx" value="" />
</Job>
I have to remove the message type name and namespace tag.
So how can I achieve this. I am sending this payload using a Receiver Soap Adapter. Please help. I am kind of stuck.hi,
you have to simply add one module in your communication channel
that is XMLAnonymizerBean
you can refer below for help:
Remove namespace prefix or change XML encoding with the XMLAnonymizerBean
http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm
hope it helps.
regards,
ujjwal kumar -
Need information about interfaces and namespaces in actionscript 3.0
Hi,
I need information about actionscript interfaces and
namespaces, I'm preparing for ACE for Flash CS3 and I need to learn
about this subjects and I can not find resources or simple examples
that make these subjects understandable.
Anybody can help me!
Thanks a lot.Interfaces (cont.)
Perhaps the most useful feature of interfaces is that you not
only can define the data type but also method signature of the
class that implements this interface. In other words, interface can
define and enforce what methods class MUST implement. This is very
useful when classes are branching in packages and team of
developers works on a large application among others.
The general syntax for an Interface with method signatures is
written the following way:
package{
public interface InterfaceName {
// here we specify the methods that will heave to be
implemented
function method1 (var1:dataType,
var2:datType,…):returnType;
function method2 (var1:dataType,
var2:datType,…):returnType;
To the previous example:
package{
public interface IQualified {
function method1 ():void;
function method2 ():int;
Let’s write a class that implements it.
If I just write:
package{
public class ClassOne extends DisplayObject implements
IQualified {
public function ClassOne(){}
I will get a compilation error that states that I did not
implement required by the interface methods.
Now let’s implement only one method:
package{
public class ClassOne extends DisplayObject implements
IQualified {
private function method1():void{
return;
public function ClassOne(){}
I will get the error again because I implemented only one out
of two required methods.
Now let’s implement all of them:
package{
public class ClassOne extends DisplayObject implements
IQualified {
private function method1():void{
return;
private function method2():int{
return 4;
public function ClassOne(){}
Now everything works OK.
Now let’s screw with return datatypes. I attempt to
return String instead of void in method1 in ClassOne:
private function method1():String{
return “blah”;
I am getting an error again – Interface requires that
the method1 returns void.
Now let’s attempt to pass something into the method1:
private function method1(obj:MovieClip):void{
return;
Oops! An error again. Interface specified that the function
doesn’t accept any parameters.
Now rewrite the interface:
package{
public interface IQualified {
function method1 (obj:MovieClip):void;
function method2 ():int;
Now compiler stops complaining.
But, if we revert the class back to:
private function method1():void{
return;
compiler starts complaining again because we don’t pass
any parameters into the function.
The point is that interface is sort of a set of rules. In a
simple language, if it is stated:
public class ClassOne implements IQualified
it says: “I, class ClassOne, pledge to abide by all the
rules that IQualified has established and I will not function
correctly if I fail to do so in any way. (IMPORTANT) I can do more,
of course, but NOT LESS.”
Of course the class that implements an interface can have
more that number of methods the corresponding interface requires
– but never less.
MORE means that in addition to any number of functions it can
implement as many interfaces as it is desired.
For instance, I have three interfaces:
package{
public interface InterfaceOne {
function method1 ():void;
function method2 ():int;
package{
public interface InterfaceTwo {
function method3 ():void;
package{
public interface InterfaceThree{
function method4 ():void;
If our class promises to implement all three interface it
must have all four classes in it’s signature:
package{
public class ClassOne extends DisplayObject implements
InterfaceOne, InterfaceTwi, InterfaceThree{
private function method1():void{return;}
private function method2():int{return 4;}
private function method3():void{return;}
private function method4():void{return;}
public function ClassOne(){}
Hope it helps. -
Private dictionaries and Namespaces
Private dictionaries and Namespaces
We ran into an issue with some email templates in converting from RC2006 to RC2008.3 where Namespace values from Private service dictionaries were not populating correctly in RC2008.
In the upgrade process from RC2006, any private dictionaries are converted to actual dictionaries. They are created in the Dictionary Group UPGD: PRIVATE DICTIONARIES and the dictionary name is based on the service name: PRIV_ServiceA.
What I found as we were testing is that the Namespace parameters in Email templates (and, presumably, conditional statements and other places) no longer worked.
The reason is that the Namespace Parameter for a private dictionary did not use a dictionary name, e.g. #SERVICE.DATA.Field1#. In order for the RC2008 version to work, we had to add dictionary references: #SERVICE.DATA.PRIV_ServiceA.Field1#.Hey M.VAL,
Thanks for the question. If your dictionary is not available after updating your device, you may need to redownload it:
iOS: Dictionary isn't available after updating to the latest version of iOS
http://support.apple.com/kb/TS5238
Thanks,
Matt M. -
The system and namespace change option
Hi Experts,
I want to integrate a certain SAP Source System within RSA1. After submitting the correct settings for Background User and RFC connection the process leads me to the Source System where I logon with an User which has authorizations in SM59. From there on (the RFC Connection backwards is already defined) I got asked whether I want to user/check/cancel this existing RFC Connection. I click on use, wait for a while and then the error (please see below) appears.
When proceeding with the steps mentioned in the error message (transaction SE03, Administration node, ...) I cannot find any IDOC Object ZSSA009. I think maybe it's related to some software component or somenthing like that which should be set as "modifiable" but I don't know which....
Any Ideas on this?
Many thanks in advance.
Best regards
Tobias
Error Message:
Message no. TO128
Diagnosis
The system and namespace change option set for this SAP System does not allow any changes to be made to object IDOC ZSSA009.
System Response
Editing is terminated, the object can only be displayed.
Procedure
If you want to edit the object IDOC ZSSA009 in this SAP System, have your system administator set the SAP System to "modifiable" for this object.
This can affect the modifiability of the namespace &1 or the namespaces that correspond to the pattern &1, as well as the global setting of the system change option.
The system change option is set using the Transport Organizer tools (Transaction SE03). Expand the Administration node and execute the program Set system change option. The options are described there.HI,
Attached link may help you in configuring the source system.
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/908836c3-7f97-2b10-4cb8-e6790361c152
Thanks,
Arun -
Get Message ID and namespace from ABAP Mapping
Hi XI Expert,
Please advise how to get the message ID and namespace from ABAP Mapping.
Thank You and best Regards
FernandHi,
To access the message ID, use the method GET_MESSAGE_ID of the controller object:
1. Fetch a protocol instance for the protocol IF_WSPROTOCOL_MESSAGE_ID.
2. To have the system return the message ID after the sender has sent a request message or the receiver has received a request message, use the method GET_MESSAGE_ID of this instance. This returns the ID by using the parameter MESSAGE_ID of type SXMSGUID.
Also you could do the same by this way also:
IF_WSPROTOCOL_XI_HEADER
has attributes messageid and interface namespace.
using this you can read the XI message header -
Add a root node and namespace declaration
According to the requirement,I have a large appended .txt file.
This .txt file is created by appending various xml files (without the namespace and root node).
I need to add a root node and namespace declaration to the large appended .txt file so that it can be read as .xml.
Please provide the pointers for the same.
Thanks & Regards,
RashiMy appended file looks like following.
<input>
<Store>
<StoreHeader>
<StoreNbr>56</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
<input>
<Store>
<StoreHeader>
<StoreNbr>123</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>B</Item>
<ItemPrice>8</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
Now according to the requirement, I need to add namespace and root node and make it like follows:
<ns0:output xmlns:ns0="http://xxx">
<input>
<Store>
<StoreHeader>
<StoreNbr>56</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
<input>
<Store>
<StoreHeader>
<StoreNbr>123</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>B</Item>
<ItemPrice>8</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
</ns0:output> -
Portal Event name and namespace (ECM)
Hi Experts
I want to register for the Portal Event that gets triggered when an employee is selected.
In the Compensation Information page, there is an employee search iview. I need to know what Portal Event name and namespace is triggered when an employee is selected.
Does somebody already know what the name and namespace is?
thanks in advance
Anton KruseFound the solution here: Parameter Passing from WDJ iview to WDABAP Iview
call function 'HR_ASR_WDA_GET_EMPLOYEE'
exporting
id = 'MSS01' "ABAP Memory ID To get the PERNR Selected.
importing
pernr = gv_pernr. -
Hi Friends,
I am using ECLIPSE IDE and writing a java class using DOM and XERCES
to traverse through an xml file which is already stored in the local drive by hard coding the path in the code.
and this is working fine.
But now i want to traverse an Active Document (an xml file that is already opened when u launch an Eclipse application) so.. is there any method in DOM to access or traverse through the current Active Document ?
if there is please let me know.. it's urgent.. help me on this please.
Thanks in advance,
-KarthikCan u send me the code. You might have missed out something on reading that XML .
-
JAXP(DOM) and schema's
Is it possible to process a document with a schema with DOM. I know it is possible with SAX but i was not sure if it was with DOM and i didn't want to get started on something that is not possible. Althought i would expect that i can seeing as schema's are W3C's standard. Thank you.
Hello one & all
I have to parse two xml files (same format but different values) and print the mismatch, if any elementwise..
I am trying to create dom for these two files butafter that not able to traverse the xml file element wise (as it is a complex file, nested elements ).
can any one guide me appropriately how to do this.with steps.
Its urgent. -
Hello -
I have an interesting situation...
I have a webservice and I want my client to be able to send a org.w3c.dom.Document object as the body of the SOAP request.
This is easily done w/ the SAAJ API for web services.
I also want to validate the Document before I send it over the wire.
Code:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(xmlFileToUpload);
I have verified that WebLogic 8.1 is using the Apache Xerces parser.
The XML file that the client will be uploading looks something like this:
<uploadJobData xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://C:\ComputingJobsUpload.xsd">
<computingJobs>
<job> .... </job>
</computingJobs>
</uploadJobData>
My schema looks like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="uploadJobData">
<xs:complexType>
<xs:all>
<xs:element name="computingJobs" type="ArrayOfComputingJobs"/>
<xs:element name="name" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="ArrayOfComputingJobs">
<xs:sequence>
<xs:element name="job" type="ComputingJob" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ComputingJob">
<xs:all>
<xs:element name="queuedTime" type="xs:dateTime"/>
<xs:element name="beginTime" type="xs:dateTime"/>
<xs:element name="endTime" type="xs:dateTime"/>
<xs:element name="numCpusUsed" type="xs:short"/>
<xs:element name="numNodesUsed" type="xs:short"/>
<xs:element name="chargeFactor" type="xs:decimal"/>
</xs:all>
</xs:complexType>
</xs:schema>
The problem is, when the code turns on validation, I get an error that states:
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'uploadJobData'.
Why is this?
Also - and an even bigger issue -
When I turn off validation, everything works fine. I can handle this, except that the newly added Document in my SOAPBody now has an XML namespace attribute (xmlns) for every element! My namespace is fairly large, so its making the content length of my SOAP request almost twice as big!
After parsing the XML file in the DocumentBuilder, the XML looks something like this:
<ns1:uploadJobData xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://C:\ComputingJobsUpload.xsd" xmlns:ns1="http://server.jobupload.services.mics.apps.mis.jlab.org">
<computingJobs xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org">
<job xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org">...</job>
</computingJobs>
<name xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org">JLab</name>
</ns1:uploadJobData>
As you can see, the parser places the namespace attribute for every element.
Is there any way to turn this off?
Thanx in advance.
--BobbyNext release is planed to be out next week. We will annouced here when they are ready for download.
-
Dbms_xslprocessor and namespaces
I'm using dbms_xslprocessor to transform xml to xml (well, more specifically, xml to rss)
My source document looks something like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<feed xmlns:xa="http://host:port/portal/pls/portal/portal.wwsrc_app_xml.get_ctm_xsd">
<title>News News and More News</title>
<link>http://host:port/portal/pls/portal/</link>
<description><![CDATA[interesting news from around the world]]></description>
<base_url>http://host:port/portal/pls/portal/url/item/</base_url>
<copyright_year>2007</copyright_year>
<contact>[email protected]</contact>
<publish_date>Wed, 25 Jul 2007 12:25 -0400</publish_date>
<item>
<guid>2BC6636E56F7092AE0440003BA91D789</guid>
<display_name>News Story</display_name>
<publish_date>Fri, 16 Mar 2007 09:56 -0400</publish_date>
<description><![CDATA[including a >hyperlink in the description]]></description>
<xa:JohnsPageGroup_StoryPlacement>A</xa:JohnsPageGroup_StoryPlacement><xa:JohnsPageGroup_PhotoURL>2D4524A81D985FECE0440003BA91D789</xa:JohnsPageGroup_PhotoURL>
<category>Unassigned</category>
</item>
... and so on...
My XSLT (for the sake of discussion here... loaded as a varchar2):
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<rss version="2.0" xmlns:xa="http://host:port/portal/pls/portal/portal.wwsrc_app_xml.get_ctm_xsd">
<channel>
<title>
<xsl:value-of select="feed/title"/>
</title>
<link>
<xsl:value-of select="feed/link"/>
</link>
<language>en</language>
<copyright>Medical College of Georgia <xsl:value-of select="feed/copyright_year"/>
</copyright>
<managingEditor><xsl:value-of select="feed/contact"/></managingEditor>
<pubDate><xsl:value-of select="feed/publish_date"/></pubDate>
<image>
<title>Medical College of Georgia</title>
<url>http://www.mcg.edu/images/mcg100.gif</url>
<link>http://www.mcg.edu</link>
</image>
<xsl:for-each select="feed/item">
<item>
<title>
<xsl:value-of select="display_name"/>
</title>
<description>
<xsl:value-of select="description"/>
</description>
<link>
<xsl:value-of select="/feed/base_url" /><xsl:value-of select="guid"/>
</link>
<category>
<xsl:value-of select="category"/>
</category>
<guid>
<xsl:value-of select="/feed/base_url" /><xsl:value-of select="guid"/>
</guid>
<xsl:for-each select="xa:*">
<xsl:copy><xsl:apply-templates select="." /></xsl:copy>
</xsl:for-each>
</item>
</xsl:for-each>
</channel>
</rss>
</xsl:template>
</xsl:stylesheet>
Really, nothing fancy going on here (and relatively new to XSL folks, so constructive criticism is appreciated)... however...
The transformed content does not include the namespace attribute, nor do any of the source elements in the "xa" namespace appear in the output... e.g.
<rss version="2.0">
<channel>
<!-- snipped -->
<item>
<title>News Story</title>
<description>including a hyperlink in the description</description>
<link>http://mcgps10.mcg.edu:7784/portal/pls/portal/url/item/2BC6636E56F7092AE0440003BA91D789</link>
<category>Unassigned</category>
<guid>http://mcgps10.mcg.edu:7784/portal/pls/portal/url/item/2BC6636E56F7092AE0440003BA91D789</guid>
</item>
... etc....
When I run this transform in another environment--say, the NetBeans IDE--I get the expected output ("xmlns:xa=..." appears in the "rss" element, and "xa" elements appear below the "item" element).
What am I missing?
Thanks for the help.
-JohnI think I've traced this problem to how my original XML document was formed. I was actually using DBMS_XMLDOM to build the document, but when creating the text nodes, I couldn't specify a namespace for them, so I just called the element (for example) "xa:JohnsPageGroup_StoryPlacement".
Would the XSL processor see this DOM structure as I intended it?
Does 9.2 have a way to specify namespace when creating nodes. Am I hosed?
-John
Maybe you are looking for
-
I am selling my medical textbooks on paper for around $90-100. When I was in the process of loading the epubs into itunes connect, the pricing tier maxed out at 39.99. I sell other books in my field selling on itunes for around $180, which is simil
-
What word processing programs are available for the MacBook with OS X 10.6.8? Is there something like Pages? How can this be purchased, downloaded and installed?
-
Mail app marked an email as junk, missed job opportunity. How can I fix this?
I pipe my school email to my gmail account, which I use the mail app to view. It usually works nicely, but I was going through my junk folder and noticed I missed a job opportunity because mail app sent it to junk. This has never happened before. I a
-
Deletion of release code from container of workflow
Hi all, In t_code SWDD, i had created a container and wrongly assigned a release code to it,,, how to delete the wrongly assinged release code from a container. regards, urendra
-
Trying to use SetLayeredWindowAttributes ...
Hello all, I've been experimenting with http://www.javaworld.com/javaworld/javatips/jw-javatip86.html and I'm currently trying to get transparency with JNI using SetLayeredWindowAttributes ... However I'm running into problems (duh). Anyway, here's m