Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I draw with xsd in TikZ?

enter image description here

share|improve this question
4  
Welcome to TeX.SE. It would be helpful to show that you made some attempt and ask a question about a specific problem you are having with the drawing. –  Peter Grill Jun 15 '12 at 7:02
3  
Welcome to TeX.SX. Could you provide a mwe to see what have you done so far? –  Claudio Fiandrino Jun 15 '12 at 7:03
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Jan 16 at 3:04
add comment

1 Answer

Second attempt. You need to add some styles to simplify the code. A good way is to create new shapes but it's a long work. Here I saved some pictures with savedbox then you can reuse them inside new nodes but you need to take some precautions like inner xsep=0. A problem is to get the same height inside rectangle spli part. here i used \mystrutbut perhaps there is a batter method to do this.

\documentclass[11pt,landscape]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart} 

\def\vstrut{\vrule height 0.75ex depth 0.75ex width 0pt}
 \def\hstrut{\vrule height 0ex depth 0ex width 3mm}  
\begin{document}
\newsavebox{\figone}
\savebox{\figone}{%    
\begin{tikzpicture}
\fill (-2mm,-1mm) rectangle  (2mm,1mm); 
\fill[yshift=3mm] (-2mm,-1mm) rectangle  (2mm,1mm); 
\fill[yshift=-3mm ] (-2mm,-1mm) rectangle  (2mm,1mm);
\draw[thick] (-6mm,0) -- (-2mm,0)  (6mm,0) -- (2mm,0) ; 
\draw[thick]  (-2mm,-3mm) -- ++(-2mm,0) -- ++(0mm,6mm)--++(2mm,0);
\draw[thick]  (2mm,-3mm) -- ++(2mm,0) -- ++(0mm,6mm)--++(-2mm,0); 
\end{tikzpicture}%
}%

\newsavebox{\figtwo}
\savebox{\figtwo}{%    
\begin{tikzpicture}
\draw (0mm,-3mm)--++(0,6mm)--++(3mm,3mm)--++(15mm,0)--++(3mm,-3mm)--++(0,-6mm)--++(-3mm,-3mm)--++(-15mm,0)--cycle;
\end{tikzpicture}%
}   

\newsavebox{\tiret}
\savebox{\tiret}{%
\begin{tikzpicture}
\draw[thick] (-2mm,0mm)--++(4mm,0);
\end{tikzpicture}%
}% 

\newsavebox{\connect} 
\savebox{\connect}{%
\begin{tikzpicture}
  \node{\usebox\figone};
  \node[inner sep=0pt] (ft){\usebox\figtwo};
  \node[draw,minimum size=6mm,anchor=center,inner sep=0pt,fill=white,inner xsep=0](m) at (ft.east){};
  \node[inner sep=0pt] at (m) {\usebox\tiret};
\end{tikzpicture}%
}
\tikzset{split style/.style={rectangle split, rectangle split parts=2, draw,rectangle split part align={left}}}

 \tikzset{square/.style={draw,minimum size=6mm,anchor=center,inner xsep=0pt,fill=white}}  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{tikzpicture}[font=\small,scale=.75,transform shape]
 \node[split style] (r1)
    {\vstrut\textbf{Root}\hstrut
    \nodepart{two} \vstrut type = Well\hstrut};
 \node[square] (b1) at (r1.east) {\usebox\tiret};
 \node[inner sep=0,anchor=west] (c1) at ([xshift=.5cm]b1.east){\usebox\connect};

 \node[split style,anchor=west] (r2) at ([xshift=0.5cm]c1.east)
    {\vstrut\textbf{BasicInfo}  1.1\hstrut
     \nodepart{two}
     \vstrut   type = Complex Type\hstrut};
  \node[square] (b2) at (r2.east) {\usebox\tiret};  
  \node[inner sep=0,anchor=west] (c2) at ([xshift=0.5cm]b2.east){\usebox\connect};    
  \draw (b1)-- (c1) (c1)-- (r2) (b2) --(c2);   
\end{tikzpicture}

\end{document}        

enter image description here

share|improve this answer
    
Thank you. I thought that there are standard shapes. –  Youra_P Jun 15 '12 at 11:21
    
@Youra_P No, the shapes in your example are not standard. Perhaps you can find a simplest way to make your drawing. –  Alain Matthes Jun 15 '12 at 12:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.