invalidelementwrapper.java

来自「java xml 应用开发」· Java 代码 · 共 95 行

JAVA
95
字号
import org.w3c.dom.Element;



class InvalidElementWrapper extends DCOutputWrapper 
{
    public InvalidElementWrapper(Element element)
    {
    	super(element);
    }

    protected String getLeafXPath()
    {
        String strLeafXPath;

        if (!m_Element.hasAttribute("LeafXPath"))
        {
            strLeafXPath = "";
        }
        else
        {
            strLeafXPath = " [" + m_Element.getAttribute("LeafXPath") + "] ";
        }
        return strLeafXPath;
    }
    
    protected String getName()
    {
        String strName;

        if (!m_Element.hasAttribute("Name"))
        {
            strName = "";
        }
        else
        {
            strName = " [" + m_Element.getAttribute("Name") + "] ";
        }
        return strName;
    }
    
    protected String getMaxOccurs()
    {
        String strMaxOccurs;

        if (!m_Element.hasAttribute("MaxOccurs"))
        {
            strMaxOccurs = "";
        }
        else
        {
            strMaxOccurs = "  MaxOccurs=" + m_Element.getAttribute("MaxOccurs")+ " ";
        }
        return strMaxOccurs;
    }
    
    protected String getMinOccurs()
    {
        String strMinOccurs;

        if (!m_Element.hasAttribute("MinOccurs"))
        {
            strMinOccurs = "";
        }
        else
        {
            strMinOccurs = "  MinOccurs=" + m_Element.getAttribute("MinOccurs")+ " ";
        }
        return strMinOccurs;
    }
    
    protected String getFoundElements()
    {
        String strFoundElements;

        if (!m_Element.hasAttribute("FoundElements"))
        {
            strFoundElements = "";
        }
        else
        {
            strFoundElements = "  FoundElements=" + m_Element.getAttribute("FoundElements")+ " ";
        }
        return strFoundElements;
    }
    
    public String toString()
    {
        String strNodeName = m_Element.getTagName();
        strNodeName += getName() + getLeafXPath() + getMessage() 
                    + getMaxOccurs() + getMinOccurs() + getFoundElements() ;
        return strNodeName;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?