Problem due to Namespace in XML
Hi,
From XI (Outbound proxy from R/3), using an XML package I am calling a webservice of a 3rd party system to create a contract. The webservice is failing. The 3rd party system is saying that it is failing becuase of the additonal lines in XML (like namespace details and hypens in the XML). Please see the below XML message that is displayed in Payload in SXMB_MONI.
<?xml version="1.0" encoding="UTF-8" ?>
<b>-</b> <<b>ns0:MT_SM_Contract xmlns:ns0="http://test.com/xi/sm"></b>
<b>-</b> <CONTRACTS>
<b>-</b> <Control>
<createdWhen>2006-06-09T06:09:52</createdWhen>
<destinationAddress />
<documentGUID>495f31bc-9f99-4e56-9db7-ce5dc7095785</documentGUID>
<operation staticValue="Change" />
<schemaVersion>31N</schemaVersion>
<sourceAddress>Global</sourceAddress>
<version>3.00</version>
</Control>
Is it possible to remove the namespace details and Hypens in XI before calling the Webservice.
Thanks
Sri
Kumar,
While defining MT, delete the name space that is automatically read in XML NameSpace field.
Go to Q no 12 in the following link:
/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions
-Naveen.
Similar Messages
-
Problem using namespace of XML docs gerenrated by XMLForm
Hi community!
I am facing a problem using namespace within a XSL stylsheet. Let me describe my problem:
I am using the SAP XMLFormsBuilder within the SAP EnterprisePortal in order to provide a HTML based form for creating and editing specific XML documents. The data in the generated documents is finally presented as HTML using XSL Transformation.
In the XMLFormsBuilder you define the Schema of the XML document and the HTML GUI of the form. The Schema document looks like below (extract):
<?xml version="1.0" encoding="utf-8"?>
<schema targetNamespace="http://www.xmlspy.com/schemas/orgchart"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xyz="http://www.xmlspy.com/schemas/orgchart" Version="6.3.0">
<element name="commodity"
default=""
minOccurs="1"
maxOccurs="1"
ns="p2p"
xmlns:p2p="http://www.portal.p2p.com">
<complexType>
<sequence>
<element name="administrative_information"
default=""
minOccurs="1"
maxOccurs="1"
ns="p2p">
<complexType>
<sequence>
<element name="creation_date"
default=""
minOccurs="1"
maxOccurs="1"
type="date"
ns="p2p"/>
As far as I understand, each element defined in the Schama belongs to the namespace "p2p" and this is exactly what I want.
The XML document generated by the form looks like below (extract):
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="show_card.xsl"?>
<commodity xmlns:xf="http://www.sapportals.com/wcm/app/xmlforms"
xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="/etc/xmlforms/P2PCategoryCard_TEST/P2PCategoryCard_TEST-Schema.xml">
<administrative_information>
<creation_date>2005-07-04</creation_date>
Consequently, the file "show_card.xsl" is the responsible XSLT stylesheet, which looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:p2p="http://www.portal.p2p.com">
<xsl:output method="html"/>
<xsl:template match="p2p:commodity">
<html>
<body>
<h2>XSLT Test</h2>
Creation Date: <xsl:value-of select="p2p:administrative_information/p2p:creation_date"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The problem in the XSLT stylesheet is, that I want to access the XML document elements using their namespace. And this is exactly what does not work for me. On the other hand, if I remove the reference to the namespace:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:p2p="http://www.portal.p2p.com">
<xsl:output method="html"/>
<xsl:template match="commodity">
<html>
<body>
<h2>XSLT Test</h2>
Creation Date: <xsl:value-of select="administrative_information/creation_date"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
the stylesheet works fine, but for some technical reasons, which I don't want to explain here, I have to use the namespace when accessing the XML document elements.
For technical reasons, I cannot change the format of the Schema document and also cannot change the format of the generated XML document. The only file I can change and control is the XSLT stylsheet.
My question is now, in the case described above, if there is any way to use the namespace in the sytlesheet when accessing the XML elements?
Any help is appreciated.
Cheers,
Adam Kreuschnerduggal.ashish wrote:
3. Some XML files contain a "iso-8859-1" character with character code 146 which appears like apostrophes but actually it is : - ’ and the problem is that words like can’t are shown as can?t by database.http://en.wikipedia.org/wiki/ISO8859-1
Scroll down in that page and you'll see that the character code 146 -- which would be 92 in hexadecimal -- is in the "unused" area of ISO8859-1. I don't know where you got the idea that it represents some kind of apostrophe-like character but it doesn't.
Edit: Actually, I do know where you got that idea. You got it from Windows-1252:
http://en.wikipedia.org/wiki/Windows-1252
Not the same charset at all. -
Can not open dreamweaver due to missing menu.xml file, how do I fix this problem?
Can not open dreamweaver due to missing menu.xml file, how do I fix this problem?
@alicia - We have seen such issues before
Allow me to quote David Powers from http://forums.adobe.com/thread/1192197
The menus.xml file is normally in your personal configuration folder. Before going to the trouble of reinstalling, try deleting your configuration folder. Details of how to find it are here: http://forums.adobe.com/thread/494812.
When you launch Dreamweaver, it should build a new configuration folder. -
Problem with old namespace in WSDL file
I have a problem with my WSDL file. My scenario is SOAP to IDOC.
Originally the ESB data types were configured under namespace urn:test1:xxx for development purposes. When it came time to implement and test, we copied the data types from the old name space to a new namespace http://company.com:interface.
After the new objects were created, all the old test objects were deleted, including the old namespace definition. Now when I generate the WSDL file, the top part of the WSDL file looks correct, but toward the bottom, there are references to the old namespace.
Does anyone know why these reference are appearing, and is there any way to correct this without deleting all my objects and rebuilding everything?
Thanks in advance for any help. Will award points for help.
TerriFound the problem....the XML namespace in the Message type still contained the old namespace. When this was changed to the new namespace, second target namespace was no longer generated.
-
Problem in placing hibernate.cfg.xml
Hi,
I have written one ejb project with hibernate in my net weaver.Now i have a problem in placing hibernate.cfg.xml.so tell me where to place it .Give some examples related to that and some related links.Hi,
you can place it into the root of the EJB project as your EJBs probably access Hibernate as persistence layer. In this case make sure that you pass the string "hibernate.cfg.xml" within the method invocation when retrieving a SessionFactory as follows:
try
Configuration cfg = new Configuration();
sessionFactory = cfg.configure
("hibernate.cfg.xml").buildSessionFactory();
catch (Throwable ex)
Otherwise the Configuration file may not be found by the application class loader due to different path syntax.
For further information you can refer to this https://www.sdn.sap.com/irj/sdn/developerareas/java?rid=/webcontent/uuid/e081a4b6-0801-0010-7fa4-c3c7a0454815#hibernate [original link is broken] [original link is broken], although the hibernate.cfg.xml file is placed in the Web-Project in this example.
Hope this helps,
Best regards,
Robin -
Removing Default Namespaces from XML
Hi All,
I am having a situation where I can't remove the default
namespace from XML mainly
because there is no namespace prefix.
I hope this code snipped makes better sense.
function test():void
document:XML =
<test xmlns:soap="
http://example.com" xmlns="
http://swanmokshi.com">
<item>peter</item>
<item>jenny</item>
<item>JK Angel</item>
<test>
// I can remove the soap namespace by doing the following
soap:Namespace = document.namespace("soap");
document.removeNamespace(soap).
Alert.show(document.toXMLString()); // should now display
the xml document without the soap namespace
Note that removing the soap namespace is easy because of the
first namespace is named "soap". How do
I removed the unnamed namespace, xmlns="
http://swanmokshi.com" ?
regards,
ArunSame problem for me.
XPath expression failed to execute. Error while processing xpath expression, the expression is "ora:processXSLT("Transformation_2.xsl", bpws:getVariableData("PartyID", "Header"))", the reason is Character reference "" is an invalid XML character.. Please verify the xpath query.
I am getting the date from Oracle Advanced Queue -
Problem in creating a build.xml for weblogic portal application
Team ,
I am facing problem in creating the build.xml using weblogic.BuildXMLGEN tool .
a) Below is the structure of my portal application
SrcCode
--- .metadata (eclipse plugins folder)
--- B2BApp ( Ear Content)
--- b2bPortal ( portal related file(controllers,jsp)
--- b2bsrc (java src)
b) Now I executed below utility to generate the build.xml "
java weblogic.BuildXMLGen -projectName B2BApp -username weblogic -file build.xml -password welcome1 F:\srcCode"
c) Based on the above step , build.xml got generated .
d) when I execute "ant compile" target from the command prompt , I see the below exception
ant compile
Buildfile: build.xml
compile:
+[wlcompile] [JAM] Warning: failed to resolve class AbstractJspBacking+
+[wlcompile] [JAM] Error: unexpected exception thrown:+
+[wlcompile] com.bea.util.jam.internal.javadoc.JavadocParsingException: Parsing failure in F:\b2bNew\b2bPortal\src\portlets\b2b\dmr\Picker\PickerController.java at line 58.+
e) I suspect , the problem is bcoz of classpath issues , as I generated build.xml donot have the references to dependent lib's.As build.xml looks like below :
+<target name="compile" description="Only compiles B2BApp application, no appc">+
+<wlcompile srcdir="${src.dir}" destdir="${dest.dir}">+
+<!-- These referenced libraries were not found -->+
+<!-- <library file="p13n-core-web-lib" /> -->+
+<!-- <library file="jersey-web-lib" /> -->+
+.....+
+....+
Please help me to reslove these issues .
PS: I able to deploy the application using 10.3.2 weblogic workshop ( i.e inbuilt eclipse )i JaySen ,
thanks for your response. As mentioned we added all the necessary library within the -librarydir but still we see the same error :
+[JAM] Error: unexpected exception thrown:+
com.bea.util.jam.internal.javadoc.JavadocParsingException: Parsing failure in F:\b2bNew\b2bPortal\src\portlets\typeAhead\TypeAheadController.java at line 70. Most likely, an annotation is declared whose type has not been imported.
at com.bea.util.jam.internal.javadoc.JavadocTigerDelegateImpl_150.getAnnotationTypeFor(JavadocTigerDelegateImpl_150.java:410)
at com.bea.util.jam.internal.javadoc.JavadocTigerDelegateImpl_150.extractAnnotations(JavadocTigerDelegateImpl_150.java:176)
at com.bea.util.jam.internal.javadoc.JavadocTigerDelegateImpl_150.extractAnnotations(JavadocTigerDelegateImpl_150.java:152)
at com.bea.util.jam.internal.javadoc.JavadocClassBuilder.addAnnotations(JavadocClassBuilder.java:404)
at com.bea.util.jam.internal.javadoc.JavadocClassBuilder.populate(JavadocClassBuilder.java:359)
===================
a) this is a upgrade project [ upgrading from wlp 8.1.4 to 10.3.2 ]
i.e we are using weblogic portal 10.3.2 version.
b) Searched some sites/forums regarding the above error, and it says something related to "jwsc" ant task [ i.e while compiling a webservice(JWS) ], but we see this error while compiling a normal controller(jpf) class :(
c) we are using "ant compile" target which internally calls wlcompile task , while executing wlcompile this error is thrown .
Help Appreciated
Thx,
Sarat -
my macbook pro was repaired and since then i can't get nor photoshop cs5 or bridge cs5 to initialize. a window appears that says it has initializing problems due to an icc profile issue.
there appear two error messages. the first one says that there has been a problem sincronizing because of a programme error. the second one appears after you clicked ok on the first window and says that photoshop couldn't be initialized because the icc profile is invalid.
does anyone know if i have to delete any system or photoshop preference? the illustrator is also having troubles. thanksthanks! what finnally worked better was renaming the «settings» folder in te «color folder» in the library with ~before the name. now indesign is asking me for thw icc profiles but still works, so i asume i can reinstall color settings only for indesign and go on.
-
Problem when decrypting an encrypted xml data with arabic data
Hi all
I have problem in decryption an encrypted Xml file. because my Xml file contains utf-8 characters, this problem occurs. after many proccess on Xml data the following code throws an Exception:
try {
// Works if the content is a single child element.
byte [] a = decbit.getBytes("UTF-8");
ByteArrayInputStream bais2 = new ByteArrayInputStream(a);
Document decdoc = docBuilder.parse(bais2);
Node decNode =
encDoc.importNode(decdoc.getFirstChild(), true);
edata.getParentNode().replaceChild(decNode,edata);
}catch(org.xml.sax.SAXParseException spe) {
//In case the content is plain text
//or a group of child elements
Text decText = encDoc.createTextNode(decbit);
edata.getParentNode().replaceChild(decText,edata);
decString = (getString((XmlDocument)encDoc));
at the line with code "Document decdoc = docBuilder.parse(bais2); " an Exception occurs with message :
org.xml.sax.SAXParseException: Illegal character at end of document, <.
whereas when I debug the project the filed "decbit", contains correct data. any way, in order to the exception, the control move to "catch" block and create a Text Node but the problem is the replaced data is like this:
<id root="588588588" extension="" displayable="false" /><beneficiaryOf typeCode="BEN">
<policyOrAccount classCode="COV" moodCode="EVN">
<id xsi:type="II" root="855855855" extension="" displayable="false" />
<author typeCode="AUT">
<carrierRole classCode="UNDWRT">
<id root="6548888888" extension="" displayable="false" />
</carrierRole>
</author>
</policyOrAccount>
</beneficiaryOf>
as you can see, tha "<" characters are < and the ">" characters are >
this really exhausted me, please help me out.
thank you, any help will be appreciated
regards
MohammadHi Naveen,
In sxmb_moni the content transmitted to the adapter(RFC)is as follows
<?xml version="1.0" encoding="UTF-8" ?>
- <ns:ZRFID_EQUIP xmlns:ns="urn:sap-com:document:sap:rfc:functions">
- <RECORDS>
- <item>
<FLOC>f1-01-01</FLOC>
<RFID_NO>I006</RFID_NO>
</item>
- <item>
<FLOC>f1-01-02</FLOC>
<RFID_NO>I002</RFID_NO>
</item>
- <item>
<FLOC>f1-01-03</FLOC>
<RFID_NO>I003</RFID_NO>
</item>
- <item>
<FLOC>f1-01-04</FLOC>
<RFID_NO>I004</RFID_NO>
</item>
- <item>
<FLOC>f1-01-05</FLOC>
<RFID_NO>I005</RFID_NO>
</item>
- <item>
<FLOC>f1-01-06</FLOC>
<RFID_NO>I001</RFID_NO>
</item>
</RECORDS>
</ns:ZRFID_EQUIP>
At r/3 side the field floc and rfid_no gets mapped to floc which is of char30
eg floc=f1-01-01I006
rfid_no= -
Remove Namespace from XML File except Attribute
Hi XI Experts ,
1.I have referred to the code of xslt Generic XSLT Code to Remove ALL Namespaces from XML:
http://forums.sdn.sap.com/thread.jspa?threadID=1920630
But this removes the Attribute : id from the records .
My expected output is supposed to be :
<?xml version="1.0" encoding="GBK"?>
<body>
<head>
<nsrsbh>112001069711</nsrsbh>
<nsrmc>诺维信(中国)生物技术有限公司出口发票</nsrmc>
<dcrq>20120209</dcrq>
<sssq_q>20111201</sssq_q>
<sssq_z>20120207</sssq_z>
<records>4</records>
</head>
<data>
<record id="1">
<fpdm></fpdm>
</record>
</data>
</body
But after using this XSLT code it removes :id from <record_1 id=> and generated the below code :
The xml file now doesn't contain teh attribute :id
<?xml version="1.0" encoding="GBK"?>
<body>
<head>
<nsrsbh>112001069711</nsrsbh>
<nsrmc>诺维信(中国)生物技术有限公司出口发票</nsrmc>
<dcrq>20120209</dcrq>
<sssq_q>20111201</sssq_q>
<sssq_z>20120207</sssq_z>
<records>4</records>
</head>
<data>
<record>
1
<fpdm></fpdm>
</record>
</data>
</body>
Could you please provide your input
Plaese note : Here XI versin iS x1 3.0 SP7 . I have tried suing the Analyzer bean for the Encoing of Chinese : GBK Intsead of UTF-8 in the Namespace . But AF_Modules/XMLAnonymizerBean is not comptacible with XI 3.0 SP7
Hence i have used the following code to remove namespcae and add Encoding :GBK instead of UTF-8:
<?xml version="1.0" ?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="GBK"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>You could use exclude-result-prefixes.
For example:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wt="http://www.example.com" exclude-result-prefixes="wt">
</xsl:stylesheet> -
Problem parsing configuration/hibernate.cfg.xml
I am trying to integrate struts with hibernate. I have created a plug-in for that and copied all the necessary jars & xmls to the classpath. I am providing the full stack trace, can any one say what could be the problem
net.sf.hibernate.HibernateException: problem parsing configuration/hibernate.cfg
.xml
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:963
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:902)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:888)
at com.plugin.HibernatePlugIn.initHibernate(HibernatePlugIn.java:72)
at com.plugin.HibernatePlugIn.init(HibernatePlugIn.java:54)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServle
t.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1029)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:86
2)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:4013)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
357)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
loyer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:625
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:431
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478
at org.apache.catalina.core.StandardService.start(StandardService.java:4
80)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:231
3)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
Caused by: org.dom4j.DocumentException: hibernate.sourceforge.net Nested excepti
on: hibernate.sourceforge.net
at org.dom4j.io.SAXReader.read(SAXReader.java:358)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:958
)Looks like a problem with Hibernate itself parsing the config file?
Here's a posting from the Hibernate forum that sounds similar:
http://forums.hibernate.org/viewtopic.php?p=2256871&highlight=&sid=e1090f717891db4535310102c61bec25
-steve- -
Mobile circuit problem due to technical problem wi...
i bought nokia C3 with one year warranty.
once it had some problem due to water falling on it..i repaired it with other agency.
after some time its circuit was short and it stopped working..when i consulted nokia care for the same,they were not ready to take the responsibility for the same..
this is my second Nokia mobile in which i had a loss..of around INR 6000/-
i can't bear this amount every time..i suggest you to take a corrective action and pls do the needful..ASAP..so that i can have a clear idea about the further action to be taken against you.How is Nokia Care responsible if you got your set repaired at non Nokia care place(voids terms of warranty) after spilling water on it ( which also voids terms of warranty)?
Please mark the post as solution if it solves your problem.
Current Device - Nokia Lumia 1020/920 -
Hi,
I have an xml which has some target namespace.
I need to remove the namespace and the qualifiers and put it on a machine using a file adapter.
Any help in this regard is highly appreciated.
With Regards,
HarshPlease go throught the below link
Removing namespace from xml created -
Hello together
I have a problem to read out an XML file with JDOM. I am in charge to read out one attribute of the XML with JDOM. But my XML file has more than one Attribute of the same type. It is repeated more than once... It looks like that...
<Resolution v="PT15M"/>
<Interval>
<Pos v="1"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="2"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="3"/>
<Qty v="0.379"/>
</Interval>
<Interval>
<Pos v="4"/>
<Qty v="2.453"/>
</Interval>
<Interval>
<Pos v="5"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="6"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="7"/>
<Qty v="1.108"/>
</Interval>
<Interval>
<Pos v="8"/>
<Qty v="2.22"/>
</Interval>
<Interval>
<Pos v="9"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="10"/>
<Qty v="0.247"/>
</Interval>
<Interval>
<Pos v="11"/>
<Qty v="0.712"/>
</Interval>
<Interval>
<Pos v="12"/>
<Qty v="0.964"/>
</Interval>
Now, I want to read out the Qty from 1 to 6 and I tried it now with an Iterator but it doesn't work...I don't know what the problem is, so please help me...
I also post the Java File here. I am sorry for y English..
package FahrplanXML;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
public class Saxwer {
//Variablendeklaration
private File inFile;
//Konstruktor
public Saxwer(File in) {
this.inFile = in;
//Weitergabe der Variablen durch return vorbereiten
//public String getDtdVersion() {
//System.out.println (scheduleDtdVersion);
//return scheduleDtdVersion;
public void saxwer() throws JDOMException, IOException {
//FileAuswahl filename = new FileAuswahl();
System.out.println(inFile);
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(inFile);
/*Elemente holen*/
//1.Stufe
//Root Element auslesen
Element schedulemessage = doc.getRootElement();
//2. Stufe
//Childs von Root Element auslesen
Element messageidentification = schedulemessage.getChild("MessageIdentification");
Element messageversion = schedulemessage.getChild("MessageVersion");
Element messagetype = schedulemessage.getChild("MessageType");
Element processtype = schedulemessage.getChild("ProcessType");
Element scheduleclassificationtype = schedulemessage.getChild("ScheduleClassificationType");
Element senderidentification = schedulemessage.getChild("SenderIdentification");
Element senderrole = schedulemessage.getChild("SenderRole");
Element receiveridentification = schedulemessage.getChild("ReceiverIdentification");
Element receiverrole = schedulemessage.getChild("ReceiverRole");
Element messagedatetime = schedulemessage.getChild("MessageDateTime");
Element scheduletimeinterval = schedulemessage.getChild("ScheduleTimeInterval");
Element scheduletimeseries = schedulemessage.getChild("ScheduleTimeSeries");
//3. Stufe
// Childs von scheduletimeseries auslesen
Element senderstimeseriesidentification = scheduletimeseries.getChild("SendersTimeSeriesIdentification");
Element senderstimeseriesversion = scheduletimeseries.getChild("SendersTimeSeriesVersion");
Element businesstype = scheduletimeseries.getChild("BusinessType");
Element product = scheduletimeseries.getChild("Product");
Element objectaggregation = scheduletimeseries.getChild("ObjectAggregation");
Element outarea = scheduletimeseries.getChild("OutArea");
Element outparty = scheduletimeseries.getChild("OutParty");
Element measurementunit = scheduletimeseries.getChild("MeasurementUnit");
Element period = scheduletimeseries.getChild("Period");
//4. Stufe
// Childs von period auslesen
Element timeinterval = period.getChild("TimeInterval");
Element resolution = period.getChild("Resolution");
Element interval = period.getChild("Interval");
//5. Stufe
// Childs von interval auslesen
Element position = interval.getChild("Pos");
Element quantity = interval.getChild("Qty");
/*Attribute holen*/
//Attribute von Root Element (Stufe 1) auslesen (aus XML)
String scheduleDtdVersion = schedulemessage.getAttributeValue ("DtdVersion");
String scheduleDtdRelease = schedulemessage.getAttributeValue ("DtdRelease");
//Attribute aus Stufe 2 auslesen (aus XML)
String messageidentificationv = messageidentification.getAttributeValue ("v");
String messageversionv = messageversion.getAttributeValue ("v");
String messagetypev = messagetype.getAttributeValue ("v");
String processtypev = processtype.getAttributeValue ("v");
String scheduleclassificationtypev = scheduleclassificationtype.getAttributeValue ("v");
String senderidentificationv = senderidentification.getAttributeValue ("v");
String senderidentificationcodingscheme = senderidentification.getAttributeValue ("codingScheme");
String senderrolev = senderrole.getAttributeValue ("v");
String receiveridentificationv = receiveridentification.getAttributeValue ("v");
String receiveridentificationcodingscheme = receiveridentification.getAttributeValue ("codingScheme");
String receiverrolev = receiverrole.getAttributeValue ("v");
String messagedatetimev = messagedatetime.getAttributeValue ("v");
String scheduletimeintervalv = scheduletimeinterval.getAttributeValue ("v");
//Attribute aus Stufe 3 auslesen (aus XML)
String senderstimeseriesidentificationv = senderstimeseriesidentification.getAttributeValue ("v");
String senderstimeseriesversionv = senderstimeseriesversion.getAttributeValue ("v");
String businesstypev = businesstype.getAttributeValue ("v");
String productv = product.getAttributeValue ("v");
String objectaggregationv = objectaggregation.getAttributeValue ("v");
String outareav = outarea.getAttributeValue ("v");
String outareacodingscheme = outarea.getAttributeValue ("v");
String outpartyv = outparty.getAttributeValue ("v");
String outpartycodingscheme = outparty.getAttributeValue ("v");
String measurementunitv = measurementunit.getAttributeValue ("v");
//Attribute aus Stufe 4 auslesen (aus XML)
String timeintervalv = timeinterval.getAttributeValue ("v");
String resolutionv = resolution.getAttributeValue ("v");
//Attribute aus Stufe 5 auslesen (aus XML)
Iterator i = period.getChildren("Interval").iterator();
while(i.hasNext()) {
Element currentElement = (Element)i.next();
Iterator j = currentElement.getAttributes().iterator();
System.out.print(j);
while(j.hasNext()) {
Attribute currentAttribute = (Attribute)j.next();
System.out.println("Attribute\t Name: "+currentAttribute.getName()+", Value: "+currentAttribute.getValue());
String positionv = position.getAttributeValue ("v");
String quantityv = quantity.getAttributeValue ("v");
Detailoberflaeche xmluebergabe = new Detailoberflaeche(scheduleDtdVersion, scheduleDtdRelease, messageidentificationv, messageversionv, messagetypev, processtypev, scheduleclassificationtypev, senderidentificationv, senderidentificationcodingscheme, senderrolev, receiveridentificationv, receiveridentificationcodingscheme, receiverrolev, messagedatetimev, scheduletimeintervalv, senderstimeseriesidentificationv, senderstimeseriesversionv, businesstypev, productv, objectaggregationv, outareav, outareacodingscheme, outpartyv, outpartycodingscheme, measurementunitv, timeintervalv, resolutionv, positionv, quantityv);
xmluebergabe.grundoberflaechen();
}Thank you for your help....
Kind regards
RogerHello together
I have a problem to read out an XML file with JDOM. I am in charge to read out one attribute of the XML with JDOM. But my XML file has more than one Attribute of the same type. It is repeated more than once... It looks like that...
<Resolution v="PT15M"/>
<Interval>
<Pos v="1"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="2"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="3"/>
<Qty v="0.379"/>
</Interval>
<Interval>
<Pos v="4"/>
<Qty v="2.453"/>
</Interval>
<Interval>
<Pos v="5"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="6"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="7"/>
<Qty v="1.108"/>
</Interval>
<Interval>
<Pos v="8"/>
<Qty v="2.22"/>
</Interval>
<Interval>
<Pos v="9"/>
<Qty v="0"/>
</Interval>
<Interval>
<Pos v="10"/>
<Qty v="0.247"/>
</Interval>
<Interval>
<Pos v="11"/>
<Qty v="0.712"/>
</Interval>
<Interval>
<Pos v="12"/>
<Qty v="0.964"/>
</Interval>
Now, I want to read out the Qty from 1 to 6 and I tried it now with an Iterator but it doesn't work...I don't know what the problem is, so please help me...
The problem is, that the Iterator doesn't bring out my Quantity Attribute (see part of the xml above). I didn't get any error messages, so I really don't know what the problem is. I am a beginner, so maybe you can help me...
I also post the Java File here. I am sorry for my English..
/*Elemente holen*/
//4. Stufe
// Childs von period auslesen
Element timeinterval = period.getChild("TimeInterval");
Element resolution = period.getChild("Resolution");
Element interval = period.getChild("Interval");
//5. Stufe
// Childs von interval auslesen
Element position = interval.getChild("Pos");
Element quantity = interval.getChild("Qty");
/*Attribute holen*/
//Attribute aus Stufe 4 auslesen (aus XML)
String timeintervalv = timeinterval.getAttributeValue ("v");
String resolutionv = resolution.getAttributeValue ("v");
//Attribute aus Stufe 5 auslesen (aus XML)
Iterator i = period.getChildren("Interval").iterator();
while(i.hasNext()) {
Element currentElement = (Element)i.next();
Iterator j = currentElement.getAttributes().iterator();
System.out.print(j);
while(j.hasNext()) {
Attribute currentAttribute = (Attribute)j.next();
System.out.println("Attribute\t Name: "+currentAttribute.getName()+", Value: "+currentAttribute.getValue());
String positionv = position.getAttributeValue ("v");
String quantityv = quantity.getAttributeValue ("v");
Thank you for your help....
Kind regards
Roger
Message was edited by:
superb
Message was edited by:
superb -
HT1386 has anyone ever had synch problems due to "PAIRING RECORD IS MISSING
Has anyone ever had synch problems due to "Pairing record missing"? Just downloaded new IOS on my computer and this is what message came up
Try rebooting your computer.
Maybe you are looking for
-
Multicam Editing in Premiere cs6 Issue
hello I have weird a problem while editing in multicam sequence. I will try to specify this: when I am start editing, its working fine, the problem start when the sequence is larg (over an hour) when I am getting to 30 minutes and more, and I have
-
Search based on grandchild attribute not working
Hi, In the model side, I've parentVO - childVO - grandchildVO & at the page level, I've a search region & the result tree table. In the search criteria (@ parentVO) I've search attributes from all three levels. When I search on attributes from parent
-
SAP-dropdown; source and content
Hi all! I have a question. I'm using PDK.NET2.0, MSSQL and portal 6.40 SP15 How can I set "DataValueField(.NET)" to a dropdown-control without showing it. I am using a stored procedure with two columns. Example: apple orange banana and these have the
-
Should I re-install the apps? I also have problems when ipdating existing apps.
-
Transport Request Not getting created automatically
Dear Sir, We are facing a problem related to , Transport Request not getting created automatically during the SPRO change activities . We have to manually create the Transport Request and then changes need to be included in the request individually